/**
 * @author 善良的YWJ
 * @Created by shanliangdeYWJ on 2022/02/14 00:58:07
 * @file change.js
 * @description
 * ```
 * es6 的 析构赋值用 es5 来实现
 * ```
 * @link [Github](https://github.com/shanliangdeYWJ)
 */
let isList = {
  1600: [1, 2, 3, 4, 5],
  2100: [1, 2, 3, 4, 6],
  2400: [1, 2, 3, 4]
}

const keys = Object.keys(isList)
console.log('keys', keys)
const init = []

for (let i = 0; i < keys.length; i++) {
  init[i] = { data: isList[keys[i]] }
}

console.log('init', init)

{
  let seris = [{ name: 'xxx' }, { name: 'yyy' }]
  Object.keys(isList).forEach((key, index) => {
    seris[index] = { ...seris[index], data: isList[key] }
  })
  console.log(seris)
}
// let obj = [{ data: '11111' }]
// obj[0].name = '11'
// console.log(obj)

var _extends = function(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i]
    for (var key in source) {
      if (Object.prototype.hasOwnProperty.call(source, key)) {
        target[key] = source[key]
      }
    }
  }
  return target
}

{
  let seris = [{ name: 'xxx' }, { name: 'yyy' }]
  Object.keys(isList).forEach((key, index) => {
    seris[index] = _extends(seris[index] || {}, { data: isList[key] })
  })
  console.log(seris)
}

